[C#][XNA 3.1] How can I host two different XNA windows inside one Windows Form?
Posted
by secutos
on Stack Overflow
See other posts from Stack Overflow
or by secutos
Published on 2010-03-14T21:43:54Z
Indexed on
2010/03/14
21:45 UTC
Read the original article
Hit count: 359
I am making a Map Editor for a 2D tile-based game. I would like to host two XNA controls inside the Windows Form - the first to render the map; the second to render the tileset. I used the code here to make the XNA control host inside the Windows Form. This all works very well - as long as there is only one XNA control inside the Windows Form. But I need two - one for the map; the second for the tileset. How can I run two XNA controls inside the Windows Form? While googling, I came across the terms "swap chain" and "multiple viewports", but I can't understand them and would appreciate support.
Just as a side note, I know the XNA control example was designed so that even if you ran 100 XNA controls, they would all share the same GraphicsDevice - essentially, all 100 XNA controls would share the same screen. I tried modifying the code to instantiate a new GraphicsDevice for each XNA control, but the rest of the code doesn't work. The code is a bit long to post, so I won't post it unless someone needs it to be able to help me.
Thanks in advance.
© Stack Overflow or respective owner